Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure FilterSomaticVcf handles PASS variants correctly #909

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

clintval
Copy link
Member

@clintval clintval commented Apr 12, 2023

If the tool was run on data that had PASS in the FILTER field then the output could be:

ATailingArtifact;EndRepairFillInArtifact;PASS

When the expected output is:

ATailingArtifact;EndRepairFillInArtifact

This PR handles variants with PASS correctly by unsetting PASS if new filters are added.


val allFilters = {
if (variant.filters == PassingFilters && newFilters.nonEmpty) newFilters.toSet
else variant.filters ++ newFilters
Copy link
Member Author

@clintval clintval Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appending filters to a PASS in a variant seems like an easy mistake (which I've made!)

What do you think of a helper that would perform a variant copy and handle PASS correctly like:

  • Variant.withFilters()
  • Variant.withFilter()

The plural would add all filters in a single copy. The singular would just add one filter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like the plural one, but not the singular. Since it involves calling copy() I worry a little that we'd end up seeing code like v.withFilter(x).withFilter(y).withFilter(z) etc.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (cbbef4a) 95.65% compared to head (7d98f22) 95.65%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #909   +/-   ##
=======================================
  Coverage   95.65%   95.65%           
=======================================
  Files         126      126           
  Lines        7294     7296    +2     
  Branches      487      480    -7     
=======================================
+ Hits         6977     6979    +2     
  Misses        317      317           
Flag Coverage Δ
unittests 95.65% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...crumgenomics/vcf/filtration/FilterSomaticVcf.scala 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@tfenne tfenne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @clintval would you like me to merge or would you like the honors?


val allFilters = {
if (variant.filters == PassingFilters && newFilters.nonEmpty) newFilters.toSet
else variant.filters ++ newFilters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like the plural one, but not the singular. Since it involves calling copy() I worry a little that we'd end up seeing code like v.withFilter(x).withFilter(y).withFilter(z) etc.

@clintval
Copy link
Member Author

Thanks @tfenne! I decided not to implement the helper method since it would do 1 copy, then I would need to do another copy to override the new INFO attributes. I suppose I could have made a static helper method without a copy, but it didn't seem worth the energy this time around.

@clintval clintval merged commit ad6e200 into fulcrumgenomics:main Apr 18, 2023
@clintval clintval deleted the cv_fix_pass_filter branch April 18, 2023 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants